<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />
    <meta name="format-detection" content="telephone=no" />
    <title>微点餐-门店实景</title>
    <link rel="stylesheet" type="text/css" href="../addons/weisrc_dish/template/css/1/wei_canyin_v1.8.4.css?v=1.0" media="all">
    <link rel="stylesheet" type="text/css" href="../addons/weisrc_dish/template/css/1/wei_dialog_v1.2.1.css?v=1.0" media="all">
    <script type="text/javascript" src="../addons/weisrc_dish/template/js/1/wei_webapp_v2_common_v1.9.4.js"></script>
    <script type="text/javascript" src="../addons/weisrc_dish/template/js/1/MTouchSlider_v1.8.0.js"></script>
    <script type="text/javascript" src="../addons/weisrc_dish/template/js/1/wei_dialog_v1.9.9.js"></script>
</head>
<body id="page_viewLarge" onorientationchange="window.location.reload()">
<section class="picBox"><div class="box">
    <div id="ts1" class="touchSlider" data-min-height="364" data-dot-color="#fff" data-drag-callback="showshopInfor">
        <div class="inner">
            <div class="sld_bar">
                {loop $store['thumb_url'] $item}
                <section class="sld_page">
                    <figure>
                        <img src="{$_W['attachurl']}{$item}"/>
                    </figure>
                </section>
                {/loop}
        </div></div>
        <div class="sldDotWarpper"><div class="sld_dots" data-relative-layout="1"></div></div>
        <div class="shopInforWrap">
            <div class="shopInfor">
                {if !empty($store['hours'])}营业时间：{$store['hours']}<br/>{/if}
                {if $store['enable_wifi']==1}<img src="../addons/weisrc_dish/template/images/icon-wifi.png">{/if}
                {if $store['enable_card']==1}<img src="../addons/weisrc_dish/template/images/icon-shuaka.png">{/if}
                {if $store['enable_room']==1}<img src="../addons/weisrc_dish/template/images/icon-baoxiang2.png">{/if}
                {if $store['enable_park']==1}<img src="../addons/weisrc_dish/template/images/icon-tingche.png">{/if}
            </div>
            {loop $thumb_Arr $item}
            <div class="shopInfor"></div>
            {/loop}
        </div>
    </div>
</div></section>
<script>

    window.addEventListener('DOMContentLoaded', function(){

        //遍历图片宽度为屏幕宽度
        _forEach('.sld_page img', function(autoImg){
            autoImg.style.width = window.innerWidth + "px";
        });
        //固定外层高度为屏幕高度
        var fixedHeight = _q('.picBox');
        fixedHeight.style.height = window.innerHeight + 'px';

        var _fixedSupport = _testFixedSupport();

        var ms = new MTouchSlider( document.querySelector('#ts1'), {
            pageCls: '.sld_page',
            barCls: '.sld_bar',
            dotsCls: '.sld_dots'
        });
        /**
         new MTouchSlider( document.querySelector('#ts2'), {
        pageCls: '.sld_page2',
        barCls: '.sld_bar2',
        dotsCls: '.sld_dots2'
    });
         */
        ms.setWidth(window.innerWidth);

        window.addEventListener(_touchSupport ? 'touchmove' : 'scroll', function(evt) {
            var bTop = _q('body').scrollTop;
            var wHt = window.innerHeight;
            var wWh = window.innerWidth;

            //分类标题浮动
            var t1 = _q('.outmenu').clientHeight + _q('.picBox').clientHeight;
            t1 = t1||150;
            var topul = _q('.slidetit');

            if (bTop > t1){
                _addClass(topul.parentNode, 'fix');
                if (_fixedSupport){
                    topul.style.position = 'fixed';
                    topul.style.top = 0;
                    topul.style.left = .5*(wWh-320) + 'px';
                }else{
                    topul.style.top = (bTop-t1)+'px';
                    topul.style.left = 0;
                }
            }else{
                _removeClass(topul.parentNode, 'fix');
                topul.style.top = 0;
                topul.style.left = 0;
                topul.style.position = 'relative';
            }
        });
    });
    var shopInfor = _qAll('.shopInfor');
    function showshopInfor(slider, page, idx) {
        for(var i = 0; i < shopInfor.length; i++) {
            if(i === idx) {
                shopInfor[i].style.display = '';
            } else {
                shopInfor[i].style.display = 'none';
            }
        }
    }
    showshopInfor(null, null, 0);

</script>

<script>
    var userSystem = 'pc';
    var ssid = '2594640081';
    (function() {
        _q('#order_tel').onclick = function(e) {
            // ios下系统默认弹窗
            if (_isIOS) {
                return true;
            }
            var self = this;
            var phone = self.getAttribute('href').match(/\d*-?\d+/);
            if (!phone[0]) {phone[0]='';}
            MDialog.confirm(
                    '', '是否拨打预订电话'+phone[0]+'？', null,
                    '确定', function(){
                        isCancle = false;
                        location.href = self.getAttribute('href');
                    }, null,
                    '返回', null, null,
                    null, true, true
            );
            return false;
        }
    })();

    function redirectMap() {
        if (userSystem == 'android') {
            //window.location.href = "/weixin/dish/showShop?action=redirectMap&ticket="+ticket+"&qrcode="+qrcode+"&ssid="+ssid+"#wechat_webview_type=1";
        } else {
            locate();
        }
        return false;
    }

    function locate(){
        if (navigator && navigator.geolocation) {
            navigator.geolocation.getCurrentPosition(geo_success, geo_error, {timeout:3000});
        } else {
            MDialog.notice('定位失败，请检查网络设置', null, 3000);
        }
    }

    function geo_success(position) {
        //window.location.href = "/weixin/dish/showShop?action=redirectMap&latitude="+position.coords.latitude+"&longitude="+position.coords.longitude+"&ticket="+ticket+"&qrcode="+qrcode+"&ssid="+ssid+"#wechat_webview_type=1";
    }

    function geo_error() {
        MDialog.notice('定位失败，请检查网络设置', null, 5000);
    }
</script>
</body>
</html>
